package com.lez.flowpractice2.fragment

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.navigation.fragment.findNavController
import com.lez.flowpractice2.R
import com.lez.flowpractice2.databinding.FragmentHomeBinding

class HomeFragment : Fragment() {

    private val mBinding: FragmentHomeBinding by lazy {
        FragmentHomeBinding.inflate(layoutInflater)
    }

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                              savedInstanceState: Bundle?): View? {
        return mBinding.root
    }

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        mBinding.apply {
            flowAndDownload.setOnClickListener{
               findNavController().navigate(R.id.action_homeFragment_to_downloadFragment)
            }
            flowAndRoom.setOnClickListener{
                findNavController().navigate(R.id.action_homeFragment_to_userFragment)
            }
            flowAndRetrofit.setOnClickListener {
                findNavController().navigate(R.id.action_homeFragment_to_articleFragment)
            }
            stateFlow.setOnClickListener {
                findNavController().navigate(R.id.action_homeFragment_to_numberFragment)
            }
            sharedFlow.setOnClickListener {
                findNavController().navigate(R.id.action_homeFragment_to_sharedFlowFragment)
            }
        }
    }
}